package com.wyj.controller;

import com.wyj.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CommonController {

    @Autowired
    UserServiceImpl userServiceImpl;


    //登录接口 登录成功后，将UUID从用户信息当中获取出来，并将其存入缓存当中，同时将我们的token返回给前端 前端将我们的token存入header的头部
    @PostMapping(value = "/login")
    public String userLogin(@RequestParam("userName") String userName) {
        if (userName == null) return "请输入用户姓名";
        String result = userServiceImpl.getGameUserByUserName(userName);

        //登录成功的话返回的就是token
        return result;
    }
}
